package com.lgr.store.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.lgr.store.dao.StorageDAO;
import com.lgr.store.utils.PageObject;
import com.lgr.store.vo.StorageVo;
import javax.annotation.Resource;
import java.util.List;

@Service
public class StorageService {
    @Resource
    StorageDAO storageDAO;

    //查询
    public List<StorageVo> list(StorageVo storage, PageObject pager){
        List<StorageVo> storageList = storageDAO.listAll(storage,pager);
        return storageList;
    }
    //查询记录数
    public int count(StorageVo storage){
        return storageDAO.getcount(storage);
    }
    //新增
    public void add(StorageVo storage){
        storageDAO.add(storage);
    }
    //删除
    @Transactional
    public void delete(Integer storageId){
        storageDAO.deleteById(storageId);
    }
    //修改
    @Transactional
    public void update(StorageVo storage){
        storageDAO.update(storage);
    }
    //获取一条数据
    @Transactional
    public StorageVo findById(Integer storageId){
        return storageDAO.findById(storageId);
    }
}